package com.hsp_java.list_;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ListExercise {
    public static void main(String[] args) {
        List list = new ArrayList();
        for (int i = 0; i < 11 ; i++) {
            list.add("hello" + i);
        }


        list.add(1, "孙猴子");
        list.remove(5);
        list.set(6, "SB");


        Iterator iterator =  list.iterator();
        while (iterator.hasNext()) {
            Object o = iterator.next();
            System.out.println(o);
        }

        System.out.println(list.get(4));

    }
}